package top.lidee.module.clientApi.twice.applet.order;

import java.util.Arrays;
import java.util.Map;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;




import top.lidee.common.service.twice.applet.SmsSkuLadderService;
import top.lidee.framework.result.PageUtils;
import top.lidee.framework.result.ResponseResult;
import top.lidee.repository.model.twice.pojo.applet.SmsSkuLadderEntity;


/**
 * 商品阶梯价格
 *
 * @author zhangzhan
 * @email 52194440@qq.com
 * @date 2024-10-18 10:38:03
 */
@Api("商品阶梯价格")
@RestController
@RequestMapping("/clientApi/applet/smsskuladder")
public class SmsSkuLadderController {
    @Autowired
    private SmsSkuLadderService smsSkuLadderService;

    /**
     * 列表
     */
    @RequestMapping(value = "/list",method = RequestMethod.POST)
    @ApiOperation(value = "商品阶梯价格列表")
    public ResponseResult list(@RequestBody Map<String, Object> params){
        PageUtils page = smsSkuLadderService.queryPage(params);

        return ResponseResult.okResultPage("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping(value = "/info/{skuLadderId}",method = RequestMethod.GET)
    @ApiOperation(value = "商品阶梯价格信息")
    public ResponseResult info(@PathVariable("skuLadderId") Integer skuLadderId){
		SmsSkuLadderEntity smsSkuLadder = smsSkuLadderService.getById(skuLadderId);

        return ResponseResult.okResultPage("SmsSkuLadder", smsSkuLadder);
    }

    /**
     * 保存
     */
    @RequestMapping(value = "/save",method = RequestMethod.POST)
    @ApiOperation(value = "商品阶梯价格保存")
    public ResponseResult save(@RequestBody SmsSkuLadderEntity smsSkuLadder){
		smsSkuLadderService.save(smsSkuLadder);

        return ResponseResult.ok();
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.PUT)
    @ApiOperation(value = "商品阶梯价格修改")
    public ResponseResult update(@RequestBody SmsSkuLadderEntity smsSkuLadder){
		smsSkuLadderService.updateById(smsSkuLadder);

        return ResponseResult.ok();
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/delete",method = RequestMethod.DELETE)
    @ApiOperation(value = "商品阶梯价格删除")
    public ResponseResult delete(@RequestBody Integer[] skuLadderIds){
		smsSkuLadderService.removeByIds(Arrays.asList(skuLadderIds));

        return ResponseResult.ok();
    }

}
